package Controller;

import Service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

// 切记这里不能用RestController
@Controller
public class HelloController {

    @Autowired
    private HelloService helloService;

    @GetMapping("/hello")
    @ResponseBody
    public String Hello(){
        String sayHello = helloService.sayHello("tomcat...");
        return sayHello;
    }

    @RequestMapping("/suc1")
    public String success1(){
        return "success";
    }
}
